package service

import (
	"context"
	pb "shop-demo/api/shop/admin/v1"
)

func (s *ShopService) ListOrder(ctx context.Context, req *pb.ListOrderReq) (*pb.ListOrderReply, error) {
	orders, err := s.ouc.ListOrder(ctx, int(req.PageNum), int(req.PageSize))
	if err != nil {
		return nil, err
	}
	replyOrders := make([]*pb.ListOrderReply_Order, 0, len(orders))
	for _, order := range orders {
		replyOrders = append(replyOrders, &pb.ListOrderReply_Order{
			Id:     order.Id,
			UserId: order.UserId,
		})
	}
	return &pb.ListOrderReply{Orders: replyOrders}, nil
}

func (s *ShopService) GetOrder(ctx context.Context, req *pb.GetOrderReq) (*pb.GetOrderReply, error) {
	return &pb.GetOrderReply{}, nil
}
